export const $version = 'v1.0.0'    // 版本号 -- token 的 key 值 根据版本号变化

export const $tokenName = `${$version}_token`

export const $getToken = () => {
  return localStorage.getItem($tokenName)
}

export const $setToken = (token) => localStorage.setItem($tokenName, token)

export const $formatSearchParam = (param = {}) => {
  let item = {}
  Object.keys(param).forEach(r => {
    if (Array.isArray(r) && r.length !== 0) {
      item[r] = param[r]
    }
    if(param[r] !== undefined){
      item[r] = param[r]
    }
  })
  return item
}